package com.liu.juc.lock;

/**
 * @author TOP_LIU
 * @description
 * @date 2021/9/12
 */
public class Ticket {

    private int number =30;

    //synchronized 本质是排队和加锁
    public synchronized  void slve(){
        if(number>0){
            System.out.println(Thread.currentThread().getName()
                    + "买了第"+number+"张票" + "剩余" + --number +"张票");
        }

    }


}
